﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>流程管理</title>
    <link href="~/element-ui/element-ui/theme-chalk/index.css" rel="stylesheet" />
    <link href="~/lib/layui/css/layui.css" rel="stylesheet" />
    <script src="~/lib/layui/layui.js"></script>
    <script src="~/js/vue.js"></script>
    <script src="~/element-ui/element-ui/element.js"></script>
    <script src="~/js/axios.min.js"></script>
</head>
<body>
    <div id="app" style="margin-left:20px">
        <br />
        <el-row>
            <el-col :span="6">
                <el-card :body-style="{ padding: '20px' }" style="width:180px">
                    <div style="padding: 14px;">
                        <i class="el-icon-edit-outline"></i>
                        <a @@click="dialogFormVisible = true">请假申请</a>
                    </div>
                </el-card>
            </el-col>
            <el-col :span="6">
                <el-card :body-style="{ padding: '20px' }" style="width:180px">
                    <div style="padding: 14px;">
                        <i class="el-icon-truck"></i>
                        <a @@click="dialogchuchai = true">出差申请</a>
                    </div>
                </el-card>
            </el-col>
            <el-col :span="6">
                <el-card :body-style="{ padding: '20px' }" style="width:180px">
                    <div style="padding: 14px;">
                        <i class="el-icon-present"></i>
                        <a @@click="dialoghuodong = true">活动申请</a>
                    </div>
                </el-card>
            </el-col>
            <el-col :span="6">
                <el-card :body-style="{ padding: '20px' }" style="width:180px">
                    <div style="padding: 14px;">
                        <i class="el-icon-time"></i>
                        <a @@click="dialogJiaban = true">加班申请</a>
                    </div>
                </el-card>
            </el-col>
        </el-row>

        <el-row>
            <el-col :span="6">
                <el-card :body-style="{ padding: '20px' }" style="width:180px">
                    <div style="padding: 14px;">
                        <i class="el-icon-edit-outline"></i>
                        <a @@click="dialogForm = true">费用报销申请</a>
                    </div>
                </el-card>
            </el-col>
            <el-col :span="6">
                <el-card :body-style="{ padding: '20px' }" style="width:180px">
                    <div style="padding: 14px;">
                        <i class="el-icon-truck"></i>
                        <a @@click="dialogForm1 = true">派车申请单</a>
                    </div>
                </el-card>
            </el-col>
        </el-row>

        @*费用报销申请*@
        <el-dialog title="费用报销申请" :visible.sync="dialogForm" width="40%">
            <el-form>
                <el-form-item>
                    <span>申请人：</span><span>@User.Identity.Name</span>
                    <span>&emsp;申请时间：</span> <el-date-picker style="width:30%" v-model="form.ApplicationTim"
                                                             type="datetime"
                                                             format="yyyy-MM-dd"
                                                             value-format="yyyy-MM-dd"
                                                             placeholder="日期时间">
                    </el-date-picker>
                </el-form-item>
                <el-form-item>
                    <span>部门：</span><el-select style="width:30%;" v-model="form.department" placeholder="请选择">
                        <el-option v-for="item in list" :key="item.depar_ID" :label="item.depar_NAME" :value="item.depar_NAME">
                        </el-option>
                    </el-select>
                    <span>&emsp;费用类型：</span><el-select style="width:30%;" v-model="form.ExpenseType" placeholder="请选择">
                        <el-option v-for="item in Expensetype" :key="item.id" :label="item.type" :value="item.type">
                        </el-option>
                </el-form-item>
                <el-form-item>
                    <span>申请费用：</span><el-input v-model="form.ApplicationFe" style="width:30%;"></el-input><span> 元</span>
                </el-form-item>
                <el-form-item>
                    <span>说明：</span><el-input style="width:80%;" type="textarea" v-model="form.explain"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @@click="dialogForm = false">取 消</el-button>
                <el-button type="primary" @@click="add()">提交</el-button>
            </div>
        </el-dialog>

        @*派车申请*@
        <el-dialog title="派车申请" :visible.sync="dialogForm1" width="548px">
            <el-form>
                <el-form-item>
                    <span>申请人：</span><span>@User.Identity.Name</span>
                    <span>&emsp;申请时间：</span> <el-date-picker style="width:30%" v-model="form1.DateOf"
                                                             type="datetime"
                                                             format="yyyy-MM-dd"
                                                             value-format="yyyy-MM-dd"
                                                             placeholder="日期时间">
                    </el-date-picker>
                </el-form-item>
                <el-form-item>
                    <span>部门：</span><el-select style="width:30%;" v-model="form1.ApplicationD" placeholder="请选择">
                        <el-option v-for="item in list" :key="item.depar_ID" :label="item.depar_NAME" :value="item.depar_NAME">
                        </el-option>
                    </el-select>
                    <span>&emsp;用车时间：</span> <el-date-picker v-model="form1.Drivingtime"
                                                             type="datetime"
                                                             format="yyyy-MM-dd hh:ss"
                                                             value-format="yyyy-MM-dd hh:ss"
                                                             placeholder="选择日期时间">
                    </el-date-picker>
                </el-form-item>
                <el-form-item>
                    <span>联系电话：</span><el-input v-model="form1.ContactNumber" style="width:30%;"></el-input>
                </el-form-item>
                <el-form-item>
                    <span>起点：</span><el-input v-model="form1.StartingPoint" style="width:30%;"></el-input>
                    <span>&emsp;终点：</span><el-input v-model="form1.Endm" style="width:30%;"></el-input>

                </el-form-item>
                <el-form-item>
                    <span>预计公里：</span><el-input v-model="form1.EstimatedKm" style="width:30%;"></el-input><span>公里</span>
                </el-form-item>
                <el-form-item>
                    <span>里程类型：</span> <el-select v-model="form1.ChengLi" placeholder="请选择">
                        <el-option v-for="item in ChengLi" :key="item.id" :label="item.name" :value="item.name">
                        </el-option>
                    </el-select>
                                       <span>&emsp;随行人数：</span><el-input v-model="form1.SeveralPeople" style="width:20%;"></el-input>

                </el-form-item>
                <el-form-item>
                    <span>目的：</span><el-input style="width:90%;" type="textarea" v-model="form1.Objective"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @@click="dialogForm1 = false">取 消</el-button>
                <el-button type="primary" @@click="add1()">提交</el-button>
            </div>
        </el-dialog>

        @*创建请假申请*@
        <el-dialog title="请假申请" :visible.sync="dialogFormVisible" width="800px">
            <el-form>
                <el-form-item>
                    <span>申请人&emsp;&emsp;</span>
                    <el-input v-model="SName" style="width:220px"></el-input>
                    <span>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;请假类型&emsp;</span>
                    <el-select v-model="Lid" placeholder="请选择">
                        <el-option v-for="item in list4" :key="item.lid" :label="item.typeName" :value="item.lid">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <span>申请部门&emsp;</span>
                    <el-select v-model="bm" placeholder="请选择">
                        <el-option v-for="item in list" :key="item.depar_ID" :label="item.depar_NAME" :value="item.depar_ID">
                        </el-option>
                    </el-select>
                    <span>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;审批人&emsp;&emsp;</span>
                    <el-select v-model="sp" placeholder="请选择">
                        <el-option v-for="item in list3" :key="item.job_ID" :label="item.job_Name" :value="item.job_ID">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <span>请假时间&emsp;</span>
                    <el-input v-model="LeaveTime" autocomplete="off" style="width:230px"></el-input>天
                </el-form-item>

                <el-form-item>
                    <span>备注</span>
                    <el-input type="textarea" v-model="remarks"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @@click="dialogFormVisible = false">取 消</el-button>
                <el-button type="primary" @@click="tj()">提交</el-button>
            </div>
        </el-dialog>






        @*创建加班申请*@
        <el-dialog title="加班申请" :visible.sync="dialogJiaban" width="800px">
            <el-form>
                <el-form-item>
                    <span>申请人&emsp;&emsp;</span>
                    <el-input v-model="jbSName" autocomplete="off" style="width:220px"></el-input>
                    <span>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;申请内容&emsp;</span>
                    <el-input v-model="jbWName" autocomplete="off" style="width:220px"></el-input>
                </el-form-item>
                <el-form-item>
                    <span>申请部门&emsp;</span>
                    <el-select v-model="jbbm" placeholder="请选择">
                        <el-option v-for="item in list" :key="item.depar_ID" :label="item.depar_NAME" :value="item.depar_ID">
                        </el-option>
                    </el-select>
                    <span>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;审批人&nbsp;&nbsp;&emsp;</span>
                    <el-select v-model="jbsp" placeholder="请选择">
                        <el-option v-for="item in list3" :key="item.job_ID" :label="item.job_Name" :value="item.job_ID">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <span>加班时间&emsp;</span>
                    <el-input v-model="ActualOvertime" autocomplete="off" style="width:220px"></el-input>小时
                </el-form-item>
                <el-form-item>
                    <span>备注</span>
                    <el-input type="textarea" v-model="jbremarks"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @@click="dialogJiaban = false">取 消</el-button>
                <el-button type="primary" @@click="addwork()">提交</el-button>
            </div>
        </el-dialog>



        @*创建出差申请*@
        <el-dialog title="出差申请" :visible.sync="dialogchuchai" width="800px">
            <el-form>
                <el-form-item>
                    <span>申请人&emsp;&emsp;</span>
                    <el-input v-model="TName" autocomplete="off" style="width:220px"></el-input>
                    <span>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;申请内容&emsp;</span>
                    <el-input v-model="travel_name" autocomplete="off" style="width:220px"></el-input>
                </el-form-item>
                <el-form-item>
                    <span>申请部门&emsp;</span>
                    <el-select v-model="Tbm" placeholder="请选择">
                        <el-option v-for="item in list" :key="item.depar_ID" :label="item.depar_NAME" :value="item.depar_ID">
                        </el-option>
                    </el-select>
                    <span>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;审批人&emsp;&nbsp;&nbsp;</span>
                    <el-select v-model="Tsp" placeholder="请选择">
                        <el-option v-for="item in list3" :key="item.job_ID" :label="item.job_Name" :value="item.job_ID">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <span>出差时间&emsp;</span>
                    <el-input v-model="Create_dj" autocomplete="off" style="width:220px">></el-input>天
                    <span>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;地点&emsp;&emsp;&emsp;</span>
                    <el-input v-model="place" autocomplete="off" style="width:220px">></el-input>
                </el-form-item>
                <el-form-item>
                    <span>备注</span>
                    <el-input type="textarea" v-model="Tremarks"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @@click="dialogFormVisible = false">取 消</el-button>
                <el-button type="primary" @@click="addTravel()">提交</el-button>
            </div>
        </el-dialog>




        @*创建活动申请*@
        <el-dialog title="活动申请" :visible.sync="dialoghuodong" width="800px">
            <el-form>
                <el-form-item>
                    <span>申请人&emsp;&emsp;</span>
                    <el-input v-model="AName" autocomplete="off" style="width:220px"></el-input>
                    <span>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;申请内容&emsp;</span>
                    <el-input v-model="Activity_NAME" autocomplete="off" style="width:220px"></el-input>
                </el-form-item>
                <el-form-item>
                    <span>申请部门&emsp;</span>
                    <el-select v-model="Abm" placeholder="请选择">
                        <el-option v-for="item in list" :key="item.depar_ID" :label="item.depar_NAME" :value="item.depar_ID">
                        </el-option>
                    </el-select>
                    <span>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;审批人&emsp;&nbsp;&nbsp;</span>
                    <el-select v-model="Asp" placeholder="请选择">
                        <el-option v-for="item in list3" :key="item.job_ID" :label="item.job_Name" :value="item.job_ID">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <span>活动时间&emsp;</span>
                    <el-date-picker type="date" placeholder="选择日期" v-model="Adate" style="width:220px"></el-date-picker>
                    <span>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;需要经费&emsp;</span>
                    <el-input v-model="funds" autocomplete="off" style="width:220px"></el-input>元
                </el-form-item>
                <el-form-item>
                    <span>地点&emsp;&emsp;&emsp;</span>
                    <el-input v-model="Aplace" autocomplete="off" style="width:220px"></el-input>
                </el-form-item>
                <el-form-item>
                    <span>备注</span>
                    <el-input type="textarea" v-model="Aremarks"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @@click="dialogFormVisible = false">取 消</el-button>
                <el-button type="primary" @@click="addActivity()">提交</el-button>
            </div>
        </el-dialog>
    </div>
    <script>
        var vm = new Vue({
            el: "#app",

            data: {
                dialogImageUrl: '',
                dialogVisible: false,
                s: null,
                Expensetype: [{ id: 1, type: "交通费" },
                { id: 2, type: "餐饮费" },
                    { id: 3, type: "其他" }],
                dialogImageUrl: '',
                dialogVisible: false,
                form: {
                    staff_NAME: sessionStorage.getItem("name"),
                    ApplicationTim: "",
                    department: "",
                    ApplicationFe:'',
                    ExpenseType: "",
                    explain: "",
                    Aid:1,
                },
                form1: {
                    staff_NAME: sessionStorage.getItem("name"),
                    DateOf :"",
                    Drivingtime:"",
                    ContactNumber: "",
                    StartingPoint:"", 
                    Endm: "",
                    EstimatedKm:"", 
                    SeveralPeople: "",
                    ChengLi: "",
                    Objective: "",
                    Aid:1
                },
                ChengLi: [{ id: 1, name: "程里内" }, {id: 2, name: "程里外"}],
                list: [],
                list2: [],
                list3: [],
                list4: [],



                SName: '',
                Lid: '',
                bm: '',
                remarks: '',
                sp: '',
                LeaveTime: '',
                formLabelWidth: '100px',
                dialogForm1:false,
                dialogForm: false,
                dialogTableVisible: false,
                dialogFormVisible: false,



                dialogJiaban: false,
                jbSName: '',
                jbWName: '',
                jbbm: '',
                jbremarks: '',
                jbsp: '',
                ActualOvertime: '',

                dialogchuchai: false,
                TName: '',
                travel_name: '',
                Tbm: '',
                Tsp: '',
                Create_dj:'',
                place: '',
                Tremarks: '',

                dialoghuodong: false,
                AName: '',
                Activity_NAME: '',
                Abm: '',
                Asp: '',
                Adate: '',
                funds: '',
                Aplace: '',
                Aremarks:''
            },
            methods: {
                add1() {
                    this.form1.staff_ID = parseInt(this.form1.staff_ID)
                    
                    this.form1.SeveralPeople = parseInt(this.form1.SeveralPeople)
                    this.form1.EstimatedKm = parseInt(this.form1.EstimatedKm)
                    
                    axios.post("/Dispatchacar/Index", this.form1).then(result => {
                        if (result.data > 0) this.$message("申请成功")
                        else this.$message.error("申请失败")
                    })
                },
                add() {
                    this.form.staff_ID = parseInt(this.form.staff_ID)
                        this.form.ApplicationFe = parseInt(this.form.ApplicationFe)
                    axios.post("/ExpenseR/Index", this.form).then(result => {
                        if (result.data > 0)this.$message("申请成功")
                        else this.$message.error("申请失败")
                    })
                },
                depart() {
                    axios.get("/System/Selectdepartments").then(result => {
                        this.list = result.data;
                    })
                },
                ztai() {
                    axios.get("/Technological/SelAstates").then(result => {
                        this.list2 = result.data;
                    })
                },
                spr() {
                    axios.get("/System/SelectPosition").then(result => {
                        this.list3 = result.data;
                    })
                },
                qjlx() {
                    axios.get("/Technological/SelLeave_type").then(result => {
                        this.list4 = result.data;
                    })
                },
                tj() {
                    var params = {
                        SName: this.SName,
                        Lid: this.Lid,
                        Depar_ID: this.bm,
                        Job_ID: this.sp,
                        DateOfApplication: new Date(),
                        LeaveTime: this.LeaveTime,
                        Aid: 1,
                        remarks: this.remarks
                    }
                    axios.post("/Technological/AddLeave", params).then(da => {
                        if (da.data == "1") {
                            this.$message({
                                showClass: true,
                                message: "添加成功",
                                type: "success"
                            })
                            this.load();
                        } else {
                            this.$message.error("添加失败");
                        }
                    })
                },

                addwork() {
                    var Work = {
                        SName: this.jbSName,
                        WName: this.jbWName,
                        Depar_ID: this.jbbm,
                        Job_ID: this.jbsp,
                        EstimatedOvertime: new Date(),
                        ActualOvertime: this.ActualOvertime,
                        Aid: 1,
                        remarks: this.jbremarks
                    }
                    axios.post("/Technological/AddWork", Work).then(da => {
                        if (da.data == "1") {
                            this.$message({
                                showClass: true,
                                message: "添加成功",
                                type: "success"
                            })
                        } else {
                            this.$message.error("添加失败");
                        }
                    })
                },
                addTravel() {
                    var t = {
                        travel_name: this.travel_name,
                        TName: this.TName,
                        Depar_ID: this.Tbm,
                        Job_ID: this.Tsp,
                        Create_date: new Date(),
                        Create_dj: this.Create_dj,
                        Aid: 1,
                        place: this.place,
                        remarks: this.Tremarks
                    }
                    axios.post("/Technological/AddTravel", t).then(da => {
                        if (da.data == 1) {
                            this.$message({
                                showClass: true,
                                message: "添加成功",
                                type: "success"
                            })
                            this.load();
                        } else {
                            this.$message.error("添加失败");
                        }
                    })
                },
                addActivity() {
                    var Activity = {
                        AName:this.AName,
                        Activity_NAME:this.Activity_NAME,
                        Depar_ID:this.Abm,
                        Job_ID: this.Asp,
                        ACREATE_DATE: new Date(),
                        Adate:this.Adate,
                        funds:this.funds,
                        place: this.Aplace,
                        Aid:1,
                        remarks:this.Aremarks
                    }
                    console.log(Activity)
                    axios.post("/Technological/AddActivity", Activity).then(da => {
                        if (da.data == 1) {
                            this.$message({
                                showClass: true,
                                message: "添加成功",
                                type: "success"
                            })
                            this.load();
                        } else {
                            this.$message.error("添加失败");
                        }
                    })
                }

            },
            created() {
                this.depart();
                this.ztai();
                this.spr();
                this.qjlx();
            },

        })
    </script>
</body>
</html>